<!-- Student Applications -->
<div class="widfats" style="width:80%;">
    <div class="widget" id="widget_students_jobs">
        <div class="toggle">&nbsp;</div>
        <h3 class="handle"><?php __('My Applied Jobs'); ?></h3>
        <div class="content">
            <div class="table">
            <table class='students_jobs'>
                <!-- Table header -->
                <thead>
                    <!--tr>
                        <th colspan="4"><?php printf(
                            __('You have %d job applications now', true),
                            count($jobs)); ?>
                        </th>
                    </tr-->
                    <tr>
                        <th width="25%"><?php __('Job Title'); ?></th>
                        <th width="25%"><?php __('Job Workplace'); ?></th>
                        <th width="10%"><?php __('Application Count'); ?></th>
                        <th width="30%"><?php __('More Information'); ?></th>
                        <th width="10%"><?php __('Actions'); ?></th>
                    </tr>
                </thead>
                <tbody>
                    <?php $jobs = $student['Job']; foreach($jobs as $i=>$job): ?>
                    <!-- Basic job infor and extra info links -->
                    <tr>
                        <td class="odd">
                            <?php e($job['title']); ?>
                            (<?php e($html->link(__('Owner', true),array(
                                'controller'=>'companies',
                                'action'=>'view',
                                $job['company_id']),
                                array('title'=>__('Click to view the owner company', true))));
                            ?>)
                        </td>
                        <td class="even">
                            <?php e($job['workplace']); ?>
                        </td>
                        <td class="odd" style="text-align:center">
                            <?php e($job['students_job_count']); ?>
                        </td>
                        <td class="even">
                            <a href="javascript:void(0)"
                                class="job_introduction"
                                name="#job_introduction_<?php echo $job['id']; ?>">
                                <?php __('JobIntroduction'); ?></a>
                            <a href="javascript:void(0)"
                                class="job_requirement"
                                name="#job_requirement_<?php echo $job['id']; ?>">
                                <?php __('JobRequirement'); ?></a>
                            <?php e($html->link(__('Similar Jobs', true),
                                array(
                                    'controller'    =>  'jobs',
                                    'action'        =>  'search',
                                    $job['title']
                                ),
                                array(
                                    'title'=>sprintf(
                                        __('Click to view jobs similar to %s', true),
                                        $job['title'])
                                )
                            )); ?>
                        </td>
                        <td class="actions">
                            <?php e($html->link(__('Delete', true),
                                array(
                                    'controller'    =>  'students_jobs',
                                    'action'        =>  'delete',
                                    $job['id']
                                ),
                                array(
                                    'title' => __('Click to delete your application for this job', true),
                                    'class' => 'link_delete_student_job'
                                )
                            )); ?>
                        </td>
                    </tr>
                    <!-- job introduction, show on user require -->
                    <tr class="tr_extra" id="job_introduction_<?php echo $job['id']; ?>">
                        <td colspan="5" class="extra"><?php echo $job['introduction'];?></td>
                    </tr>
                    <!-- job requirement, show on user require -->
                    <tr class="tr_extra" id="job_requirement_<?php echo $job['id']; ?>">
                        <td colspan="5" class="extra"><?php echo $job['requirement'];?></td>
                    </tr>
                    <?php endforeach; ?>
                </tbody>
            </table>
            </div>
        </div>
    </div>
</div>
<br class="clear">

<?php //debug($student); ?>

<script type='text/javascript'>
jQuery(function(){
    /* Bind job introduction and requirement toggler */
    $('.tr_extra:visible').hide();
    $('a.job_introduction').click(toggle);
    $('a.job_requirement').click(toggle);
    function toggle(){
        $('.tr_extra:visible').hide();
        $(this.name).toggle();
    }
    /* Ajax anti apply */
    $('div#widget_students_jobs a.link_delete_student_job').click($.sme.cbk.ajaxAntiApply);
});
</script>
